import { MONITOR } from "@/api/config/servicePort";
import http from "@/api";
import { ResPage } from "@/api/interface";
import { ResultData } from "@/api/interface/index";
/**
 * @name 监控阈值模块
 */
// 监控阈值列表
export const getThresholdList = (params?: object) => {
  return http.get<ResPage<any>>(MONITOR + `/threshold/`, params);
};
// 监控阈值详情
export const getThresholdDetail = (id?: number) => {
  return http.get(MONITOR + `/threshold/${id}`);
};

// 删除监控阈值
export const ThresholdTerminate = (params: { ids: any[] }) => {
  return http.delete(MONITOR + `/threshold/${params.ids[0]}/`); // 正常 post json 请求  ==>  application/json
};

// 创建监控阈值
export const createThreshold = params => {
  return http.post(MONITOR + `/threshold/`, params);
};

// 修改监控阈值
export const modifyThreshold = (id, params) => {
  return http.put(MONITOR + `/threshold/${id}/`, params);
};

// 获取监控模块
export const getMonitorModule = () => {
  return http.get<ResultData>(MONITOR + `/base/modules/`);
};

// 监控对象
export const getMonitorObject = id => {
  return http.get(MONITOR + `/base/${id}/targets/`);
};

//监控指标
export const getMonitorIndex = id => {
  return http.get(MONITOR + `/base/${id}/indexes/`);
};
